import 'package:flutter/material.dart';

class MyApp5 extends StatelessWidget {
  const MyApp5({super.key});

  @override
  Widget build(BuildContext context) {
    final screen = MediaQuery.of(context).size;

    return Scaffold(
      appBar: AppBar(
        title: Text('Container组件', style: TextStyle(color: Colors.white)),
        backgroundColor: Colors.orange,
        centerTitle: true,
      ),
      body: Center(
        child: Container(
          width: 300,
          height: screen.height / 3,
          color: Colors.green, //背景色
          child: Container(
            // 对齐方式
            alignment: Alignment.bottomCenter,
            width: 200,
            height: 150,
            // color: Colors.yellow,
            decoration: BoxDecoration(
              // 如果有decoration,设置背景颜色要设置在decoration内
              color: Colors.yellow,
              // borderRadius: BorderRadius.circular(20),
              // 圆角
              borderRadius: BorderRadius.only(topLeft: Radius.circular(20)),
              // 边框
              border: Border.all(color: Colors.black, width: 10),
            ),
            // margin: EdgeInsets.all(20),
            margin: EdgeInsets.only(top: 20, left: 40),
            padding: EdgeInsets.all(20),
            child: const Text('我是容器组件'),
          ),
        ),
      ),
    );
  }
}
